<template>
    <div class="setting">
        <div class="center-win">
            <img src="../../assets/user-head.jpg" class="user-head">
            <div class="user-item"><b>用户编号：</b>{{user.userId}}</div>
            <div class="user-item"><b>用户名：</b>{{user.name}}</div>
            <div class="user-item"><b>联系电话：</b>{{user.phone}}</div>
            <el-button class="exit-btn" size="small" :disabled="disabled" @click="exitLogin">退出登录</el-button>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Setting",
        data() {
            return {
                user: {},
                disabled: false,
            }
        },
        methods: {
            exitLogin() {
                this.disabled = true;
                this.$store.commit("setLogin", null);
                this.$router.push({path: '/login'})
            }
        },
        mounted() {
            this.user = this.$store.state.userInfo;
        }
    }
</script>

<style lang="less" scoped>
    .setting {
        background-color: rgb(236, 235, 233);
        width: 100%;
        height: 100%;
        position: relative;

        .center-win {
            position: absolute;
            /*border: 1px solid #ccc;*/
            width: 300px;
            height: 300px;
            top: 150px;
            left: 50%;
            margin-left: -150px;

            .user-head {
                height: 100px;
                width: 100px;
                margin: 10px 0 5px 0;
            }

            .user-item {
                margin: 5px 0 10px 0;
                text-align: left;
            }

            .exit-btn {
                width: 150px;
            }
        }
    }
</style>